<{include file='customer/head.html'}>
<body>
	<div class="akr_main_inner_bg">
		<div class="wid97">
			<{if $pmsuserinfo.isitadministrator==1 || $pmsuserinfo.powerlist & 1}>
				<input type="button" class="akrBtn blue userProjectRecord" value="+&nbsp;添加">
			<{/if}>
			<div class="inforBar">
				<span>项目：</span>
				<select class="prjid mr10">
					<option value="-1">全部</option>	
					<{foreach $prolist as $k=>$v}>
					<option value="<{$v.id}>"><{$v.name}></option>
					<{/foreach}>
				</select>
				<span>客户：</span>
				<select class="customer_id mr10">
					<option value="-1">全部</option>	
					<{foreach $custlist as $k=>$v}>
					<option value="<{$v.id}>"><{$v.name}></option>
					<{/foreach}>
				</select>
				<span>项目状态：</span>
				<select class="prjstaus mr10">
					<option value="-1">全部</option>	
					<option value="0">开发中</option>
					<option value="1">已上线</option>
				</select>
				<span>进度状态：</span>
				<select class="status mr10">
					<option value="998">全部</option>
					<option selected value="999">待处理</option>				
					<option value="0">新建</option>
					<option value="1">项目经理已签字</option>
					<option value="19">项目经理打回</option>
					<option value="2">总经理已签字</option>
					<option value="29">项目经理打回</option>
					<option value="3">研发已签字</option>
					<option value="39">研发打回</option>
					<option value="100">完成</option>
				</select>
				<span>是否加急：</span>
				<select class="isquick">
					<option value="-1">全部</option>	
					<option value="0">不加急</option>
					<option value="1">加急</option>
				</select>
			</div>
		</div>
		<table class="akrTable akrTable_back">
			<thead>
				<tr>
					<th>ID</th>
					<th>客户</th>
					<th>项目</th>
					<th>项目状态</th>
					<th>需要时间</th>
					<th>是否加急</th>
					<th>进度状态</th>
					<th>创建用户</th>
					<th>创建时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody class="prorecord_html">
				<{foreach $list as $k=>$v}>
					<tr>
						<td><{$v.id}></td>
						<td><{$v.custmoername}></td>
						<td><{$v.projectname}></td>
						<td><{if $v.prjstaus==1}>已上线<{else}>未上线<{/if}></td>
						<td><{$v.needtime}></td>
						<td><{if $v.isquick==1}>加急<{else}>不加急<{/if}></td>
						<td>
							<{if $v.status==0}>新建
							<{elseif $v.status==1}>项目经理已签字
							<{elseif $v.status==19}>项目经理打回
							<{elseif $v.status==2}>总经理已签字
							<{elseif $v.status==29}>总经理打回
							<{elseif $v.status==3}>研发已签字
							<{elseif $v.status==39}>研发打回
							<{elseif $v.status==100}>完成
							<{else}>未知<{/if}>
						</td>
						<td><{$v.username}></td>
						<td><{$v.addtime|date_format:"%Y-%m-%d %H:%M:%S"}></td>
						<td>
							<span class="spanBtn" onclick="ProRecordeDetails('<{$v.id}>')">详情</span>
							<{if $pmsuserinfo.isitadministrator==1 || $pmsuserinfo.powerlist & 1}>
							<span class="spanBtn" onclick="ProRecordeEit('<{$v.id}>')">编辑</span>
							<{/if}>
								
							<{if $v.status==0}>
								<{if $pmsuserinfo.isitadministrator==1 || $pmsuserinfo.powerlist & 2}>
								<span class="spanBtn" onclick="verify_status('<{$v.id}>')">项目经理审核</span>
								<{/if}>
							<{elseif $v.status==1}>
								<{if $pmsuserinfo.isitadministrator==1 || $pmsuserinfo.powerlist & 4}>
								<span class="spanBtn" onclick="verify_status('<{$v.id}>')">总经理审核</span>
								<{/if}>
							<{elseif $v.status==19}>
								
							<{elseif $v.status==2}>
								<{if $pmsuserinfo.isitadministrator==1 || $pmsuserinfo.powerlist & 8}>
								<span class="spanBtn" onclick="verify_status('<{$v.id}>')">研发审核</span>
								<{/if}>
							<{elseif $v.status==29}>
								
							<{elseif $v.status==3}>
								<span class="spanBtn" onclick="YfInfo('<{$v.id}>')">研发名单</span>
								<{if $pmsuserinfo.isitadministrator==1 || $pmsuserinfo.powerlist & 16}>
								<span class="spanBtn" onclick="verify_status('<{$v.id}>')">完成</span>
								<{/if}>
							<{elseif $v.status==39}>
								
							<{elseif $v.status==100}>
								<span class="spanBtn" onclick="YfInfo('<{$v.id}>')">研发名单</span>
								<{if $pmsuserinfo.isitadministrator==1 || $pmsuserinfo.powerlist & 16}>
								<!-- <span class="spanBtn" onclick="verify_status('<{$v.id}>')">撤销</span> -->
								<{/if}>
							<{/if}>
							<span class="spanBtn" onclick="ProRecordLog('<{$v.id}>')">进度记录</span>
							<{if $pmsuserinfo.isitadministrator==1}>
							<span class="spanBtn" onclick="ProRecordDel('<{$v.id}>')">删除</span>
							<{/if}>
						</td>
					</tr>
				<{/foreach}>
			</tbody>
		</table>
		<div class="page">
			<{$pageshow}>
		</div>
	</div>
	<script type="text/javascript">
		//删除
		function ProRecordDel(id){
			_hcinits.init(['_ajaxs_min','_layer_admin_min'],function(){
				_ajaxs=_hcinits._ajaxs;
				_layer_admin=_hcinits._layer_admin;
				_layer_admin.confirm('确认删除吗?',function(){
					_ajaxs.post('/ProjectRecord/projectRecordDel','id='+id,function(data){
						if(data.status){
							_layer_admin.successMsg(data.message,function(){
								var page=$('.current').html();
								if(page==undefined){
									page=1;
								}
								ajaxpage(page);
							})
							
						}else{
							_layer_admin.errorMsg(data.message);
						}
					})
				})
			})
		}
		//研发名单
		function YfInfo(id){
			var logurl='<{$pmsroot}>/ProjectRecord/projectYfInfo?id='+id;
			_hcinits.init(['_layer_admin_min'],function(){
				_layer_admin=_hcinits._layer_admin;
				_layer_admin.open('研发名单',logurl);
			})
		}
		//进度记录
		function ProRecordLog(id){
			var logurl='<{$pmsroot}>/ProjectRecord/projectRecordLog?id='+id;
			_hcinits.init(['_layer_admin_min'],function(){
				_layer_admin=_hcinits._layer_admin;
				_layer_admin.open('进度记录',logurl);
			})
		}
		//审核回调函数
		function verify_return(){
			var page=$('.current').html();
			if(page==undefined){
				page=1;
			}
			ajaxpage(page);
		}
		//审核
		function verify_status(id){
			var vhtml='<{$pmsroot}>/ProjectRecord/projectRecordVerifyHtml?id='+id+'&listverify=1';
			_hcinits.init(['_layer_admin_min'],function(){
				_layer_admin=_hcinits._layer_admin;
				_layer_admin.open('审核',vhtml,'600px','400px');
			})
		}
		function ProRecordeDetails(id){
			var verifyurl='<{$pmsroot}>/ProjectRecord/projectRecordeDetails?id='+id;
			_hcinits.init(['_layer_admin_min'],function(){
				_layer_admin=_hcinits._layer_admin;
				_layer_admin.open('详情',verifyurl,'90%','90%');
			})
		}
		function ProRecordeEit(id){
			var editurl='<{$pmsroot}>/ProjectRecord/projectRecordEdit?id='+id;
			_hcinits.init(['_layer_admin_min'],function(){
				_layer_admin=_hcinits._layer_admin;
				_layer_admin.open('编辑项目状况',editurl,'90%','90%');
			})
		}
		function ajaxpage(page){
			_hcinits.init(['_ajaxs_min','_form_min','_layer_admin_min'],function(){
				_ajaxs=_hcinits._ajaxs;
				_layer_admin=_hcinits._layer_admin;
				_form=_hcinits._form;
				var url='';
				url+=_form.geturl('select','.prjid','prjid','-1');
				url+=_form.geturl('select','.customer_id','customer_id','-1');
				url+=_form.geturl('select','.prjstaus','prjstaus','-1');
				url+=_form.geturl('select','.status','status','-1');
				url+=_form.geturl('select','.isquick','isquick','-1');
				url=_form.geturl('url',url);
				if(url!=''){url+='&page='+page;}else{url+='page='+page;}
				_ajaxs.post('/ProjectRecord/projectRecordList',url,function(data){
					if(data.status){
						$('.prorecord_html').html(data.data.html);
						$('.page').html(data.data.pageshow);
					}else{
						_layer_admin.errorMsg(data.message);
					}
				})
			})
		}
		$(function(){
			//添加
			$('.userProjectRecord').click(function(){
				var addurl='<{$pmsroot}>/ProjectRecord/projectRecordAdd';
				_hcinits.init(['_layer_admin_min'],function(){
					_layer_admin=_hcinits._layer_admin;
					_layer_admin.open('添加项目状况',addurl,'90%','90%');
				})
			})
			//搜索
			$('.prjid').click(function(){
				ajaxpage(1);
			})
			//搜索
			$('.customer_id').click(function(){
				ajaxpage(1);
			})
			$('.prjstaus').click(function(){
				ajaxpage(1);
			})
			$('.status').click(function(){
				ajaxpage(1);
			})
			$('.isquick').click(function(){
				ajaxpage(1);
			})
		})
	</script>
</body>
</html>